.class public Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;
.super Landroid/os/AsyncTask;
.source "Search.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lde/dealdoktor/app/activities/Search;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x4
    name = "GetSearchResultsTask"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/os/AsyncTask",
        "<",
        "Ljava/lang/String;",
        "Ljava/lang/Void;",
        "Ljava/lang/Boolean;",
        ">;"
    }
.end annotation


# instance fields
.field private posts:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lde/dealdoktor/app/data/PostDAO;",
            ">;"
        }
    .end annotation
.end field

.field private sortByDate:Z

.field final synthetic this$0:Lde/dealdoktor/app/activities/Search;


# direct methods
.method public constructor <init>(Lde/dealdoktor/app/activities/Search;Z)V
    .locals 0
    .parameter
    .parameter "sortByDate"

    .prologue
    .line 124
    iput-object p1, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    .line 122
    invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V

    .line 123
    iput-boolean p2, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->sortByDate:Z

    return-void
.end method


# virtual methods
.method protected varargs doInBackground([Ljava/lang/String;)Ljava/lang/Boolean;
    .locals 4
    .parameter "args"

    .prologue
    .line 152
    :try_start_0
    iget-object v1, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    #getter for: Lde/dealdoktor/app/activities/Search;->searchQuery:Ljava/lang/String;
    invoke-static {v1}, Lde/dealdoktor/app/activities/Search;->access$1(Lde/dealdoktor/app/activities/Search;)Ljava/lang/String;

    move-result-object v1

    iget-object v2, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    #getter for: Lde/dealdoktor/app/activities/Search;->currentPage:I
    invoke-static {v2}, Lde/dealdoktor/app/activities/Search;->access$2(Lde/dealdoktor/app/activities/Search;)I

    move-result v2

    iget-boolean v3, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->sortByDate:Z

    invoke-static {v1, v2, v3}, Lde/dealdoktor/app/data/DataModel;->getSearchResults(Ljava/lang/String;IZ)Ljava/util/ArrayList;

    move-result-object v1

    iput-object v1, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->posts:Ljava/util/ArrayList;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 157
    iget-object v1, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->posts:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    if-lez v1, :cond_0

    .line 158
    iget-object v1, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    #getter for: Lde/dealdoktor/app/activities/Search;->currentPage:I
    invoke-static {v1}, Lde/dealdoktor/app/activities/Search;->access$2(Lde/dealdoktor/app/activities/Search;)I

    move-result v2

    add-int/lit8 v2, v2, 0x1

    #setter for: Lde/dealdoktor/app/activities/Search;->currentPage:I
    invoke-static {v1, v2}, Lde/dealdoktor/app/activities/Search;->access$3(Lde/dealdoktor/app/activities/Search;I)V

    .line 160
    :cond_0
    const/4 v1, 0x1

    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    :goto_0
    return-object v1

    .line 153
    :catch_0
    move-exception v0

    .line 154
    .local v0, e:Ljava/lang/Exception;
    const-string v1, "exception"

    const-string v2, "GetSearchResultsTask doInBackground"

    invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    .line 155
    const/4 v1, 0x0

    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    goto :goto_0
.end method

.method protected bridge varargs synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .parameter

    .prologue
    .line 1
    check-cast p1, [Ljava/lang/String;

    invoke-virtual {p0, p1}, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->doInBackground([Ljava/lang/String;)Ljava/lang/Boolean;

    move-result-object v0

    return-object v0
.end method

.method protected onPostExecute(Ljava/lang/Boolean;)V
    .locals 3
    .parameter "success"

    .prologue
    const/4 v2, 0x0

    .line 135
    invoke-virtual {p1}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    if-nez v0, :cond_1

    .line 136
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    iput-boolean v2, v0, Lde/dealdoktor/app/activities/Search;->isLoading:Z

    .line 147
    :cond_0
    :goto_0
    return-void

    .line 139
    :cond_1
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->posts:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    if-lez v0, :cond_2

    .line 140
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    iget-object v0, v0, Lde/dealdoktor/app/activities/Search;->listAdapter:Lde/dealdoktor/app/adapter/PostListAdapter;

    iget-object v1, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->posts:Ljava/util/ArrayList;

    invoke-virtual {v0, v1}, Lde/dealdoktor/app/adapter/PostListAdapter;->addData(Ljava/util/ArrayList;)V

    .line 141
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    iput-boolean v2, v0, Lde/dealdoktor/app/activities/Search;->isLoading:Z

    .line 143
    :cond_2
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    iget-boolean v0, v0, Lde/dealdoktor/app/activities/Search;->isLoading:Z

    if-eqz v0, :cond_0

    .line 144
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    #getter for: Lde/dealdoktor/app/activities/Search;->loadingView:Landroid/view/View;
    invoke-static {v0}, Lde/dealdoktor/app/activities/Search;->access$0(Lde/dealdoktor/app/activities/Search;)Landroid/view/View;

    move-result-object v0

    const v1, 0x7f0b003b

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    const/16 v1, 0x8

    invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

    .line 145
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    #getter for: Lde/dealdoktor/app/activities/Search;->loadingView:Landroid/view/View;
    invoke-static {v0}, Lde/dealdoktor/app/activities/Search;->access$0(Lde/dealdoktor/app/activities/Search;)Landroid/view/View;

    move-result-object v0

    const v1, 0x7f0b003d

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    invoke-virtual {v0, v2}, Landroid/view/View;->setVisibility(I)V

    goto :goto_0
.end method

.method protected bridge synthetic onPostExecute(Ljava/lang/Object;)V
    .locals 0
    .parameter

    .prologue
    .line 1
    check-cast p1, Ljava/lang/Boolean;

    invoke-virtual {p0, p1}, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->onPostExecute(Ljava/lang/Boolean;)V

    return-void
.end method

.method protected onPreExecute()V
    .locals 2

    .prologue
    .line 128
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    const/4 v1, 0x1

    iput-boolean v1, v0, Lde/dealdoktor/app/activities/Search;->isLoading:Z

    .line 129
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->this$0:Lde/dealdoktor/app/activities/Search;

    #getter for: Lde/dealdoktor/app/activities/Search;->loadingView:Landroid/view/View;
    invoke-static {v0}, Lde/dealdoktor/app/activities/Search;->access$0(Lde/dealdoktor/app/activities/Search;)Landroid/view/View;

    move-result-object v0

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

    .line 130
    return-void
.end method
